package pages;

import finds.Finder;
import io.appium.java_client.android.AndroidDriver;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;

/**
 * Created by 13714526025 on 2018/9/19.
 * Description：封装首页操作的工具类
 */
public class HomePage {
    private AndroidDriver<WebElement> driver;
    private Finder finder;
    public HomePage(Finder finder){
        this.finder=finder;
    }
    //右上角“添加”按钮点击
    public void addBtnClick(){
        driver.findElement(By.id("com.oppo.ohome:id/iv_add")).click();
    }
    //设置按钮点击
    public void settingBtnClick(){
        driver.findElement(By.id("com.oppo.ohome:id/iv_setting")).click();
    }
    //首页昵称点击
    public void userNameClick(){
      finder.findElementById("com.oppo.ohome:id/tv_title").click();
    }
    //根据索引点击设备
    public void deviceForIndex(int index){
        driver.findElements(By.id("com.oppo.ohome:id/iv_company")).get(index).click();
    }
    //屏幕中心“添加设备”按钮点击
    public void centerAddDevice(){
        driver.findElement(By.id("com.oppo.ohome:id/left_settingItem")).click();
    }


}
